<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateTag extends Migrator
{
    public function up()
    {
        $table = $this->table('tag', ['commont' => '标签表']);
        $table->addColumn('tag_name', 'string', ['limit' => 120, 'default' => '', 'comment' => '标签名称'])
            ->addColumn('positive_score1', 'integer', ['limit' => 4, 'default' => 0, 'comment' => '正分值1'])
            ->addColumn('positive_score2', 'integer', ['limit' => 4, 'default' => 0, 'comment' => '正分值2'])
            ->addColumn('negative_score1', 'integer', ['limit' => 4, 'default' => 0, 'comment' => '负分值1'])
            ->addColumn('negative_score2', 'integer', ['limit' => 4, 'default' => 0, 'comment' => '负分值2'])
            ->addColumn('create_time', 'integer', ['limit' => 10, 'signed' => false, 'default' => time()])
            ->create();
    }

    public function down()
    {
        $this->dropTable('tag');
    }
}
